package org.spiderflow.core.utils;

import cn.hutool.core.codec.Base64;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.AES;
import cn.hutool.crypto.symmetric.DES;
import cn.hutool.crypto.symmetric.RC4;
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;

/**
 * @author fanyushuai
 * @version 1.0
 * @description: TODO
 * @date 2021/12/6 18:24
 */
public class EncodeUtils {

    private static final String BASE64_SECRET = "aEsva0zDHECg47P8SuPzmw==";

    private final static byte[] SECRET_BYTES = Base64.decode(BASE64_SECRET);

    public static String des(String content) {
        //随机生成密钥
        //byte[] key = SecureUtil.generateKey(SymmetricAlgorithm.AES.getValue()).getEncoded();
        //构建
        DES des = SecureUtil.des(SECRET_BYTES);
        //加密
        return des.encryptHex(content);
    }

    public static void main(String[] args) {
        System.out.println(des("分以上"));
    }
}
